<!doctype html>



  


<html class="theme-next pisces use-motion">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  
  
  <link href="/vendors/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/vendors/font-awesome/css/font-awesome.min.css?v=4.4.0" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.0.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Hexo, NexT" />





  <link rel="alternate" href="/atom.xml" title="liujinlongxa的技术博客" type="application/atom+xml" />




  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.0.1" />






<meta name="description" content="继续记录6月份开发中遇到的问题。
UIBarButtonItem点击区域的问题今天在定制导航上的返回按钮遇到了一个问题，顺便记录一下。
一般常规的定制导航栏返回按钮的方法如下：
1self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@&quot;back&quot;] st">
<meta property="og:type" content="article">
<meta property="og:title" content="2016年6月开发问题记录">
<meta property="og:url" content="http://yoursite.com/2016/06/05/2016年6月开发问题记录/index.html">
<meta property="og:site_name" content="liujinlongxa的技术博客">
<meta property="og:description" content="继续记录6月份开发中遇到的问题。
UIBarButtonItem点击区域的问题今天在定制导航上的返回按钮遇到了一个问题，顺便记录一下。
一般常规的定制导航栏返回按钮的方法如下：
1self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@&quot;back&quot;] st">
<meta property="og:image" content="http://7xn88v.com1.z0.glb.clouddn.com/d869dc4bbc06c476771fc0cfe1b19d49.png">
<meta property="og:image" content="http://7xn88v.com1.z0.glb.clouddn.com/639a2d998265085ba8f03b4fb3cc6068.png">
<meta property="og:image" content="http://7xn88v.com1.z0.glb.clouddn.com/0b15b63f3ddab728a7c593154f0083a2.png">
<meta property="og:image" content="http://7xn88v.com1.z0.glb.clouddn.com/90fa287185b4062e4c37dd86ac05436b.png">
<meta property="og:image" content="http://7xn88v.com1.z0.glb.clouddn.com/88e710b25fdcd0403ba7fe2610bd1547.png">
<meta property="og:updated_time" content="2016-07-01T12:43:36.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="2016年6月开发问题记录">
<meta name="twitter:description" content="继续记录6月份开发中遇到的问题。
UIBarButtonItem点击区域的问题今天在定制导航上的返回按钮遇到了一个问题，顺便记录一下。
一般常规的定制导航栏返回按钮的方法如下：
1self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@&quot;back&quot;] st">
<meta name="twitter:image" content="http://7xn88v.com1.z0.glb.clouddn.com/d869dc4bbc06c476771fc0cfe1b19d49.png">



<script type="text/javascript" id="hexo.configuration">
  var NexT = window.NexT || {};
  var CONFIG = {
    scheme: 'Pisces',
    sidebar: {"position":"left","display":"post"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: 0,
      author: '博主'
    }
  };
</script>




  <link rel="canonical" href="http://yoursite.com/2016/06/05/2016年6月开发问题记录/"/>

  <title> 2016年6月开发问题记录 | liujinlongxa的技术博客 </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  










  
  
    
  

  <div class="container one-collumn sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta ">
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">liujinlongxa的技术博客</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle"></p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>

 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  
  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                2016年6月开发问题记录
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            <span class="post-meta-item-icon">
              <i class="fa fa-calendar-o"></i>
            </span>
            <span class="post-meta-item-text">发表于</span>
            <time itemprop="dateCreated" datetime="2016-06-05T00:00:00+08:00" content="2016-06-05">
              2016-06-05
            </time>
          </span>

          
            <span class="post-category" >
              &nbsp; | &nbsp;
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="https://schema.org/Thing">
                  <a href="/categories/iOS开发/" itemprop="url" rel="index">
                    <span itemprop="name">iOS开发</span>
                  </a>
                </span>

                
                

              
            </span>
          

          
            
              <span class="post-comments-count">
                &nbsp; | &nbsp;
                <a href="/2016/06/05/2016年6月开发问题记录/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2016/06/05/2016年6月开发问题记录/" itemprop="commentsCount"></span>
                </a>
              </span>
            
          

          

          
          

          
        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>继续记录6月份开发中遇到的问题。</p>
<h2 id="UIBarButtonItem点击区域的问题"><a href="#UIBarButtonItem点击区域的问题" class="headerlink" title="UIBarButtonItem点击区域的问题"></a>UIBarButtonItem点击区域的问题</h2><p>今天在定制导航上的返回按钮遇到了一个问题，顺便记录一下。</p>
<p>一般常规的定制导航栏返回按钮的方法如下：</p>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">self</span>.navigationItem.leftBarButtonItem = [[<span class="built_in">UIBarButtonItem</span> alloc] initWithImage:[<span class="built_in">UIImage</span> imageNamed:<span class="string">@"back"</span>] style:<span class="built_in">UIBarButtonItemStyleDone</span> target:<span class="keyword">self</span> action:<span class="keyword">@selector</span>(clickBackBtn:)];</div></pre></td></tr></table></figure>
<p>这样写有一个问题，运行代码后，返回按钮的可点击区域如下图所示：</p>
<p><img src="http://7xn88v.com1.z0.glb.clouddn.com/d869dc4bbc06c476771fc0cfe1b19d49.png" alt="1"></p>
<p>这并不是我想要的，点击区域太大，完全没有点到返回按钮上都可以触发返回操作。于是换一种思路，用自定义View实现，代码如下：</p>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">UIButton</span> *backBtn = [[<span class="built_in">UIButton</span> alloc] initWithFrame:<span class="built_in">CGRectMake</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">30</span>, <span class="number">44</span>)];</div><div class="line">[backBtn addTarget:<span class="keyword">self</span> action:<span class="keyword">@selector</span>(clickBackBtn:) forControlEvents:<span class="built_in">UIControlEventTouchUpInside</span>];</div><div class="line">[backBtn setImage:[<span class="built_in">UIImage</span> imageNamed:<span class="string">@"back"</span>] forState:<span class="built_in">UIControlStateNormal</span>];</div><div class="line"><span class="keyword">self</span>.navigationItem.leftBarButtonItem = [[<span class="built_in">UIBarButtonItem</span> alloc] initWithCustomView:backBtn];</div></pre></td></tr></table></figure>
<p>编译运行，效果依然一样，点击区域还是太大，如下图：</p>
<p><img src="http://7xn88v.com1.z0.glb.clouddn.com/639a2d998265085ba8f03b4fb3cc6068.png" alt="2"></p>
<p>这我就不明白了，于是一阵Google，找到了一个解决方案，代码如下：</p>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">UIButton</span> *backBtn = [[<span class="built_in">UIButton</span> alloc] initWithFrame:<span class="built_in">CGRectMake</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">30</span>, <span class="number">44</span>)];</div><div class="line">[backBtn addTarget:<span class="keyword">self</span> action:<span class="keyword">@selector</span>(clickBackBtn:) forControlEvents:<span class="built_in">UIControlEventTouchUpInside</span>];</div><div class="line">[backBtn setImage:[<span class="built_in">UIImage</span> imageNamed:<span class="string">@"back"</span>] forState:<span class="built_in">UIControlStateNormal</span>];</div><div class="line"><span class="built_in">UIView</span> *containerView = [[<span class="built_in">UIView</span> alloc] initWithFrame:<span class="built_in">CGRectMake</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">30</span>, <span class="number">44</span>)];</div><div class="line">[containerView addSubview:backBtn];</div><div class="line"><span class="keyword">self</span>.navigationItem.leftBarButtonItem = [[<span class="built_in">UIBarButtonItem</span> alloc] initWithCustomView:containerView];</div></pre></td></tr></table></figure>
<p>这样点击区域就正常了，如下图：</p>
<p><img src="http://7xn88v.com1.z0.glb.clouddn.com/0b15b63f3ddab728a7c593154f0083a2.png" alt="3"></p>
<p>其实就是在Button外面又包了一层View，这样点击区域就只有Button那么大，我怀疑，可能是加载BarButtonItem上的自定义View都会被自动的拉长，暂时还没找到其他解决方案。</p>
<p>Reference：<a href="http://stackoverflow.com/questions/16858433/uibarbuttonitem-tap-area" target="_blank" rel="external">UIBarButtonItem tap area</a></p>
<h2 id="将自定义对象作为NSDictionary的Key"><a href="#将自定义对象作为NSDictionary的Key" class="headerlink" title="将自定义对象作为NSDictionary的Key"></a>将自定义对象作为NSDictionary的Key</h2><p>将自定义对象作为NSDictionary的Key，需要重写自定义isEqual方法和hash方法。isEqual方法比较简单，如下代码：</p>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">- (<span class="built_in">BOOL</span>)isEqual:(<span class="keyword">id</span>)object &#123;</div><div class="line">    Student *st = (Student *)object;</div><div class="line">    <span class="keyword">if</span> ([st.name isEqualToString:<span class="keyword">self</span>.name] &amp;&amp; st.age == <span class="keyword">self</span>.age) &#123;</div><div class="line">        <span class="keyword">return</span> <span class="literal">YES</span>;</div><div class="line">    &#125;</div><div class="line">    <span class="keyword">else</span> &#123;</div><div class="line">        <span class="keyword">return</span> <span class="literal">NO</span>;</div><div class="line">    &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<p>但是如果要把自定义的对象作为NSDictionary的Key，光重写isEqual方法是不够的，还需要重写hash方法，如果不重写hash方法就会导致字典不能正确的添加和删除。重写hash函数的方法很多，可以通过构建不同散列函数来实现，但是无论哪种方法，目的都是尽可能的确保相同的对象返回的hash值相同，一个简单的方法就是使用每一个属性的hash的异或的结果来作为这个对象的hash值。代码如下：</p>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">- (<span class="built_in">NSUInteger</span>)hash &#123;</div><div class="line">    <span class="keyword">return</span> [<span class="keyword">self</span>.name hash] ^ <span class="keyword">self</span>.age;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<p>这样构建的hash值冲突的概率很小。另外，要作为字典的Key，还必须实现<code>NSCopying</code>协议。因为不需要做深拷贝，所以只需要简单的返回self即可，代码如下：</p>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">- (<span class="keyword">id</span>)copyWithZone:(<span class="built_in">NSZone</span> *)zone &#123;</div><div class="line">    <span class="keyword">return</span> <span class="keyword">self</span>;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<p>这个构建的一个对象就可以作为NSDictionary的Key了。</p>
<p>Reference：<a href="http://nshipster.com/equality/" target="_blank" rel="external">Equality</a></p>
<h2 id="UITableViewCell的“no-index-path-for-table-cell-being-reused”问题"><a href="#UITableViewCell的“no-index-path-for-table-cell-being-reused”问题" class="headerlink" title="UITableViewCell的“no index path for table cell being reused”问题"></a>UITableViewCell的“no index path for table cell being reused”问题</h2><p>项目中有一个自定义的UITableViewCell，由于版本更新，要把这个Cell改为可以悬停的SectionHeader，为了图方便，我没有重新自定义一个View，而是直接在<code>viewForHeaderInSection:</code>方法里返回了cell，代码如下：</p>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">LMBookWriteCommentCell *cell = (LMBookWriteCommentCell *)[<span class="keyword">self</span> tableView:<span class="keyword">self</span>.tableView writeCommentCellWithIndexPath:<span class="literal">nil</span>];</div><div class="line"><span class="keyword">return</span> cell;</div></pre></td></tr></table></figure>
<p>这样写有个问题，就是在reloadData时，这SectionHeader就消失了，变成了空白的一片，并且出现了“no index path for table cell being reused”错误，程序没有崩溃，但是就是看不见Cell上的内容。于是一阵Google，终于找到了答案，只要把上面的代码的<code>return cell;</code>改为<code>return cell.contentView;</code>就可以了。</p>
<p>Reference：<a href="http://stackoverflow.com/questions/12772197/what-is-the-meaning-of-the-no-index-path-for-table-cell-being-reused-message-i?lq=1" target="_blank" rel="external">What is the meaning of the “no index path for table cell being reused” message in iOS 6/7?</a></p>
<h2 id="Autolayout动画的正确姿势"><a href="#Autolayout动画的正确姿势" class="headerlink" title="Autolayout动画的正确姿势"></a>Autolayout动画的正确姿势</h2><p>做Autolayout动画的一般步骤是：</p>
<ol>
<li>修改约束，如果使用Masonry，使用<code>mas_updateConstraints</code>方法修改约束，如果使用Xib，则直接把要修改的约束通过拉线链接到代码里进行修改即可。</li>
<li>在动画的block中，调用View的<code>layoutIfNeed()</code>方法。</li>
</ol>
<p>这里要注意的一点是第二步，如果直接调用<code>view.layoutIfNeed()</code>，可能会导致动画不能进行，正确的方法应该是调用<code>view.superview.layoutIfNeed()</code>，这样才能正确的进行动画。完整代码如下：</p>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">class</span> ViewController: <span class="built_in">UIViewController</span> &#123;</div><div class="line"></div><div class="line">    @IBOutlet <span class="keyword">weak</span> var myView: <span class="built_in">UIView</span>!</div><div class="line">    @IBOutlet <span class="keyword">weak</span> var topConstraint: <span class="built_in">NSLayoutConstraint</span>!</div><div class="line"></div><div class="line">    override func viewDidLoad() &#123;</div><div class="line">        <span class="keyword">super</span>.viewDidLoad()</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    override func touchesBegan(touches: Set&lt;<span class="built_in">UITouch</span>&gt;, withEvent event: <span class="built_in">UIEvent</span>?) &#123;</div><div class="line">        topConstraint.constant += <span class="number">100</span></div><div class="line">        <span class="built_in">UIView</span>.animateWithDuration(<span class="number">2.0</span>) &#123;</div><div class="line">            <span class="keyword">self</span>.myView.superview?.layoutIfNeeded()</div><div class="line">        &#125;;</div><div class="line">    &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<h2 id="在iOS7上UILabel的省略点颜色不正确"><a href="#在iOS7上UILabel的省略点颜色不正确" class="headerlink" title="在iOS7上UILabel的省略点颜色不正确"></a>在iOS7上UILabel的省略点颜色不正确</h2><p>在iOS7上，有时UILabel的省略点的颜色与文字的颜色不同，如下图：</p>
<p><img src="http://7xn88v.com1.z0.glb.clouddn.com/90fa287185b4062e4c37dd86ac05436b.png" alt="uilable color error"></p>
<p>网上查了一下，这应该是iOS7的一个Bug，解决方法就是不要使用textColor设置文字颜色，而使用attributeText，代码如下：</p>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">NSAttributedString</span> *attStr = [[<span class="built_in">NSAttributedString</span> alloc] initWithString:<span class="keyword">self</span>.titleLabel.text attributes:@&#123;<span class="built_in">NSForegroundColorAttributeName</span>:style.fColor, <span class="built_in">NSFontAttributeName</span>:style.font&#125;];</div><div class="line"><span class="keyword">self</span>.titleLabel.attributedText = attStr;</div></pre></td></tr></table></figure>
<p>参考：<a href="http://stackoverflow.com/questions/22718172/uilabel-dotted-line-color-bug-in-ios-7-1" target="_blank" rel="external">UILabel dotted line color bug in iOS 7.1</a></p>
<h2 id="iOS7上，给UICollectionViewCell添加长按手势的坑"><a href="#iOS7上，给UICollectionViewCell添加长按手势的坑" class="headerlink" title="iOS7上，给UICollectionViewCell添加长按手势的坑"></a>iOS7上，给UICollectionViewCell添加长按手势的坑</h2><p>项目中有一个需求，当长按任何一个UICollectionViewCell时，刷新UICollectionView，每一个Cell的右上角都出现一个选择按钮。效果如下：</p>
<p><img src="http://7xn88v.com1.z0.glb.clouddn.com/88e710b25fdcd0403ba7fe2610bd1547.png" alt="iOS7 UICollectionView longPress"></p>
<p>这是一个比较常见的需求，我的做法是在每一个Cell上添加一个长按手势，然后，在手势触发时，刷新这个UICollectionView，然每一个Cell都显示选择按钮。这样做在iOS8，iOS9上都没有问题，当时在iOS7上却出现了问题。在iOS7上，当触发某一个Cell的长按手势之后，这个Cell就不再响应UICollectionView的<code>collectionView:didSelectItemAtIndexPath:</code>方法了。</p>
<p>网上没有找到类似的情况，只能自己解决。最终找到了一种解决方案，代码如下：</p>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line"><span class="comment">// 必须重新放在主线程队列中，否则在iOS7上回出现Cell不触发didSelect的情况</span></div><div class="line"><span class="built_in">dispatch_async</span>(dispatch_get_main_queue(), ^&#123;</div><div class="line">    [<span class="keyword">self</span>.collectionView reloadData];</div><div class="line">&#125;);</div></pre></td></tr></table></figure>
<p>要将reloadData重新放在主线程队列中，这样就不会出现这种情况。具体原因不是非常明白，但是，这样确实可以完美的解决这个问题。</p>

      
    </div>

    <div>
      
        
      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2016/05/29/自定义NSOperation的那些事/" rel="next" title="自定义NSOperation的那些事">
                <i class="fa fa-chevron-left"></i> 自定义NSOperation的那些事
              </a>
            
          </div>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2016/06/11/打造自己的翻墙VPS:搬运工VPS购买使用流程全记录/" rel="prev" title="打造自己的翻墙VPS:搬运工VPS购买使用流程全记录">
                打造自己的翻墙VPS:搬运工VPS购买使用流程全记录 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div class="ds-thread" data-thread-key="2016/06/05/2016年6月开发问题记录/"
           data-title="2016年6月开发问题记录" data-url="http://yoursite.com/2016/06/05/2016年6月开发问题记录/">
      </div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel ">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/smallhead.png"
               alt="liujinlongxa" />
          <p class="site-author-name" itemprop="name">liujinlongxa</p>
          <p class="site-description motion-element" itemprop="description">生命永不息，Coding永不止</p>
        </div>
        <nav class="site-state motion-element">
          <div class="site-state-item site-state-posts">
            <a href="/archives">
              <span class="site-state-item-count">31</span>
              <span class="site-state-item-name">日志</span>
            </a>
          </div>

          
            <div class="site-state-item site-state-categories">
              <a href="/categories">
                <span class="site-state-item-count">3</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            <div class="site-state-item site-state-tags">
              <a href="/tags">
                <span class="site-state-item-count">3</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        
          <div class="feed-link motion-element">
            <a href="/atom.xml" rel="alternate">
              <i class="fa fa-rss"></i>
              RSS
            </a>
          </div>
        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/liujinlongxa" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://twitter.com/JaylonLiu" target="_blank" title="Twitter">
                  
                    <i class="fa fa-fw fa-twitter"></i>
                  
                  Twitter
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="http://weibo.com/u/1523828165/home" target="_blank" title="微博">
                  
                    <i class="fa fa-fw fa-globe"></i>
                  
                  微博
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://www.douban.com/people/2470188/" target="_blank" title="豆瓣">
                  
                    <i class="fa fa-fw fa-globe"></i>
                  
                  豆瓣
                </a>
              </span>
            
          
        </div>

        
        

        
        

      </section>

      
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">
            
              
            
            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#UIBarButtonItem点击区域的问题"><span class="nav-number">1.</span> <span class="nav-text">UIBarButtonItem点击区域的问题</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#将自定义对象作为NSDictionary的Key"><span class="nav-number">2.</span> <span class="nav-text">将自定义对象作为NSDictionary的Key</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#UITableViewCell的“no-index-path-for-table-cell-being-reused”问题"><span class="nav-number">3.</span> <span class="nav-text">UITableViewCell的“no index path for table cell being reused”问题</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Autolayout动画的正确姿势"><span class="nav-number">4.</span> <span class="nav-text">Autolayout动画的正确姿势</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#在iOS7上UILabel的省略点颜色不正确"><span class="nav-number">5.</span> <span class="nav-text">在iOS7上UILabel的省略点颜色不正确</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#iOS7上，给UICollectionViewCell添加长按手势的坑"><span class="nav-number">6.</span> <span class="nav-text">iOS7上，给UICollectionViewCell添加长按手势的坑</span></a></li></ol></div>
            
          </div>
        </section>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2016</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">liujinlongxa</span>
</div>

<div class="powered-by">
  由 <a class="theme-link" href="http://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Pisces
  </a>
</div>

        

        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  



  
  <script type="text/javascript" src="/vendors/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/vendors/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/vendors/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/vendors/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/vendors/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/vendors/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.0.1"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.0.1"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.0.1"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.0.1"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.0.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.0.1"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.0.1"></script>



  

  
    
  

  <script type="text/javascript">
    var duoshuoQuery = {short_name:"liujinlongxa"};
    (function() {
      var ds = document.createElement('script');
      ds.type = 'text/javascript';ds.async = true;
      ds.id = 'duoshuo-script';
      ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
      ds.charset = 'UTF-8';
      (document.getElementsByTagName('head')[0]
      || document.getElementsByTagName('body')[0]).appendChild(ds);
    })();
  </script>

  
    
  






  
  
  

  

  

</body>
</html>
